<?php

namespace App\Models;


class ReplyText extends BaseModel
{
    protected $table = "reply_text";

    protected $redisTable = "reply_text";

    protected $rules = [
        'admin_id' => 'required',
        'menu_id' => 'required',
        'content' => 'required',
    ];

    protected $message = [
        'admin_id.required' => '非法操作',
        'menu_id.required' => '非法操作',
        'content.required' => '请填写内容',
    ];


    public function addOrUpdate($admin_id,$menu_id,$content)
    {
        $data['admin_id'] = $admin_id;
        $data['menu_id'] = $menu_id;
        $data['content'] = $content;
        if (!$this->_validate($data)) {
            return false;
        }
        $res = $this->_save($data);
        if (!$res) {
            $this->error = '保存失败!';
            return false;
        }
        return $res;
    }

}